<template>
    <div v-if="isAdmin">
    </div>
    <div v-else>
        <div>当前预览为测试版</div>
        <div>登录时间：{{ time }}</div>
        <div>到期时间：{{getNowDate()}}</div>
    </div>
</template>

<script setup lang="ts">
import { dateTypeFormat } from '@/utils/tools'
const {password} = JSON.parse(localStorage.getItem('$user') || '{ "password":"" }')
const isAdmin = password && password.slice(0,4) === '0731'
const time = dateTypeFormat('YYYY-mm-dd HH:MM:SS',JSON.parse(localStorage.getItem('$user') || '{ "time":"" }').time)
const getNowDate = () => {
    const now = new Date()
    now.setDate(now.getDate()+1)
    const month = `${now.getMonth() + 1}`.padStart(2,'0')
    const day = now.getDate()
    const year = now.getFullYear()
    return `${year}-${month}-${day} 00:00:00`
}
</script>